<?php
include_once("class.lib/db.class.php");
include_once("class.lib/etablissement.class.php");

header('Content-type: text/html; charset=iso-8859-1') ;
//echo "<meta http-equiv=\"Content-Type\" content=\"text/html; charset=iso-8859-1\" />";

                  //echo substr($_POST['id'],0,1);
		          $etab = new Etablissement();
                  $etb=$etab->getAllEtablissement(substr($_POST['id'],1));
				  
				  // Variation du nom du menu d�roulant en fonction du formulaire
				  if(substr($_POST['id'],0,1)=="a") 
				    $libelle="etablissement";
				  else
				    $libelle="etablissement_rattach";	
					$etabstr=$_POST['etab'];
				  
echo "Etablissement :<br><select name=\"".$libelle."\" id=\"".$libelle."\" maxlength=\"23\">	

<option value=\"autre\" >Autre</option>";

				
				  // Liste des �tablissements
                 while (list($clef,$valeur)=each($etb)) 
				     {  $libelle = strtr($valeur[2],'ÀÁÂÃÄÅÇÈÉÊËÌÍÎÏÒÓÔÕÖÙÚÛÜÝàáâãäåçèéêëìíîïðòóôõöùúûüýÿ','AAAAAACEEEEIIIIOOOOOUUUUYaaaaaaceeeeiiiioooooouuuuyy');
						//echo "<OPTION value=".$valeur[0].">".utf8_encode($valeur[2])."</OPTION>";
						
						//$str=$valeur[0]==$etabstr ?  ' selected="selected" ' :'');
						echo "<OPTION value=".$valeur[0]." $str>".$libelle."</OPTION>";
                     }

 echo "</select>";
 ?>
